/*
 *    Copyright 2011-2012 The Hook Team
 *
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 */
package org.hook.yaksha.node;

import org.hook.yaksha.config.Config;
import org.hook.yaksha.exception.AnalysisException;

/**
 * 基础节点的接口定义
 * 
 * @author suwuqiang 2011-12-26
 */
public interface Node<E extends NodeEvent, C extends Config> extends Runnable, Component<C> {

	/**
	 * 节点的主流程处理逻辑
	 */
	public void process() throws AnalysisException;

	/**
	 * 向Node发送消息
	 * 
	 * @param event
	 * @return
	 */
	public boolean addEvent(E event);

	/**
	 * 节点如何处理事件的实现
	 * 
	 * @param event
	 */
	public void processEvent(E event) throws AnalysisException;

	/**
	 * 启动节点
	 */
	public void startNode();

	/**
	 * 停止节点
	 */
	public void stopNode();
}
